package com.derbysoft.lowcostadapter.commons.model;

import com.derbysoft.common.domain.PersistenceSupport;
import com.derbysoft.lowcostadapter.commons.redis.utils.KeyValueHelper;

import javax.persistence.Column;
import javax.persistence.Entity;

/**
 * User: jason
 * Date: 2012-11-15
 */
@Entity
public class ProviderIdentification extends PersistenceSupport {

    public static final String PREFIX = "PID:";

    @Column(unique = true, length = 30)
    private String channelCode;

    @Column(nullable = false, length = 50)
    private String userName;

    @Column(nullable = false, length = 100)
    private String passWd;

    @Column(nullable = false, length = 50)
    private String agentReference;


    public String toKey() {
        return PREFIX + channelCode;
    }

    public String toValue() {
        return userName + KeyValueHelper.SEPARATOR + passWd + KeyValueHelper.SEPARATOR + agentReference;
    }

    public String getChannelCode() {
        return channelCode;
    }

    public void setChannelCode(String channelCode) {
        this.channelCode = channelCode;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWd() {
        return passWd;
    }

    public void setPassWd(String passWd) {
        this.passWd = passWd;
    }

    public String getAgentReference() {
        return agentReference;
    }

    public void setAgentReference(String agentReference) {
        this.agentReference = agentReference;
    }
}
